package com.ruoyi.api.project.projectUsers;

import com.ruoyi.project.projectInfo.domain.ProjectInfo;
import com.ruoyi.project.projectUsers.domain.ProjectUsers;
import com.ruoyi.project.projectUsers.service.IProjectUsersService;
import com.ruoyi.result.ResultEnum;
import com.ruoyi.result.ResultView;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@EnableAsync
@RestController
@Slf4j
public class MobileProjectUsersController {
  @Autowired
  private IProjectUsersService projectUsersService;

  /**
   * 查询项目人员列表
   */
  @PostMapping("/api/project/projectUsers/listByprojectInfoId")
  @ResponseBody
  public ResultView listByprojectInfoId(Long projectInfoId) {
    if (projectInfoId == null) {
      return ResultView.error(ResultEnum.CODE_2);
    }
    ProjectUsers projectUsers = new ProjectUsers();
    projectUsers.setProjectinfoid(projectInfoId);
    List<ProjectUsers> list = projectUsersService.selectProjectUsersList(projectUsers);
    return ResultView.ok(list);
  }
}
